import pygame


def button(image_location, image_size, word, word_size, word_location, image):
    new_button = pygame.image.load(image).convert_alpha()
    font = pygame.font.Font("../Docs/images/WenDingTeYanKai-2.ttf", word_size)
    text = font.render(word, True, (0, 0, 0))
    changed_button = pygame.transform.scale(new_button, image_size)
    from Main import screen
    (x, y) = pygame.mouse.get_pos()
    if (x > image_location[0]) & (x < image_location[0] + image_size[0]) & (y > image_location[1]) & (
            y < image_location[1] + image_size[1]):
        changed_button1 = pygame.transform.scale(changed_button, (image_size[0] + 10, image_size[1] + 10))
        pygame.event.get()
        press_array = pygame.mouse.get_pressed()
        if press_array[0]:
            screen.blit(text, word_location)
            screen.blit(changed_button, image_location)
            while 1:
                pygame.event.get()
                press_array = pygame.mouse.get_pressed()
                if press_array[0] == 0:
                    return 1
        screen.blit(text, word_location)
        screen.blit(changed_button1, (image_location[0] - 5, image_location[1] - 5))
    else:
        screen.blit(text, word_location)
        screen.blit(changed_button, image_location)
    return 0

# 弹出窗口
# 确定取消窗口 tkinter.messagebox.askokcancel('提示', '要执行此操作吗')
# 输入文本框 name = askstring('Name', 'What is your name?')
